package com.gqb.quartz;

import org.quartz.JobBuilder;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.SimpleScheduleBuilder;
import org.quartz.Trigger;
import org.quartz.TriggerBuilder;
import org.quartz.impl.StdSchedulerFactory;

public class QuartzTry {
	public static void main(String[] args) {
		try {
			Scheduler scheduler = StdSchedulerFactory.getDefaultScheduler();
			scheduler.start();
			JobDetail job = JobBuilder.newJob(HelloJob.class)
					.withIdentity("job1", "group1").build();
			Trigger trigger = TriggerBuilder
					.newTrigger()
					.withIdentity("job1", "group1")
					.withSchedule(
							SimpleScheduleBuilder.repeatSecondlyForever(10)
									.withRepeatCount(10)).startNow().build();
			scheduler.scheduleJob(job, trigger);
		} catch (SchedulerException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
